<%@page import="sdfi.lee.Entity.Qanswer"%>
    <%@page import="sdfi.lee.DAO.QuestionDAO"%>
<%@page import="sdfi.lee.Entity.Question"%>
<%@page import="java.util.List"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta content="<a href='<c:url value='/question/faq.jsp?type=1&pg=1' />' >常见问题</a>" name="location">
<link rel="stylesheet" href="../css/index.css" />
<link rel="stylesheet" href="../css/level.css" />
<script type="text/javascript" src="../js/jquery-1.6.js"></script>
<script type="text/javascript" src="../js/index.js"></script>
<title>国家新药创制平台（山东）</title>
</head>
<body>
<%
	String id=request.getParameter("id");
	QuestionDAO dao=new QuestionDAO();
	if(id!=null)
	{
		Question question=dao.getQuestionById(Integer.valueOf(id));
		request.setAttribute("qu",question);
	}
	String type=request.getParameter("type");
	String pg=request.getParameter("pg");
	if(pg!=null&&type!=null){
		List<Question> list=dao.getAllUserQuest(
				20,
				Integer.valueOf(pg).intValue(),
				Integer.valueOf(type).intValue());
		request.setAttribute("list",list);
	}
%>
	<c:if test="${requestScope.qu!=null }">
			<div class="faqqu">
			<div class="faqqushow">
				当前问题：${qu.question}
			</div>
			<div class="faqanswer">
				
					
						${qu.answer.answer}
						
	
				
			</div>
			</div>
	</c:if>
	
		<c:forEach items="${requestScope.list}" var="question" varStatus="status">
		<div class="faqqu">
			<div class="faqqushow">
				问题${status.index+1}：${question.question}
			</div>
			<div class="faqanswer">
				
					
						${question.answer.answer}
						
	
				
			</div>
		
		</div>
	</c:forEach>
	
	<div style="clear:left;"></div>
   <div id="pages">
                	
                	每页<font>20</font>条,第<font>${param.pg}</font>页,该页
                	<font>${fn:length(requestScope.list) }</font>条
                    <c:choose>
                		<c:when test='${param.pg==null||param.pg==""||param.pg==1}'>
                			上页
                		</c:when>
                		<c:otherwise>
                			<c:url value='/question/faq.jsp?type=${param.type }&pg=${param.pg-1}'  var="down"/>
                			 <a href="${down}">上页</a>
                		</c:otherwise>
                	</c:choose>
                	
                   	<c:choose>
                   		<c:when test="${fn:length(requestScope.list)<20}">
                   			下页
                   		</c:when>
                   		<c:otherwise>
                   		<a href="<c:url value='/question/faq.jsp?type=${param.type}&pg=${param.pg+1}' />">下页</a>
                   		
                   		</c:otherwise>
                   	</c:choose>
                    
                </div>
</body>
</html>